[nginx] how to restrict access to directory and subdirs

Posted by tst on Server Fault See other posts from Server Fault or by tst
Published on 2010-05-02T21:55:03Z Indexed on 2010/05/02 21:59 UTC
Read the original article Hit count: 272

Filed under:
|
|

I need to restrict access to any files or subdirs in direstory "testdir". My conf:

...
location ~* ^.+\.(jpg|txt)$ {
            root   /var/www/site;
        }
location /testdir {
        deny all;
        return 404;
        }
...

In my configuration I have no restrictions on /testdir/jpg_or_txt-files. How to do it?

© Server Fault or respective owner

Related posts about nginx

Related posts about deny